Delete file

Purpose of this building block

With this building block you can delete a file with the given file id from Google Drive.

1 variables
0 variables
${fileId}

Possible use cases

  • Archive files at project end

Configuration

Click on the bold text in the title of the building block to open the configuration dialog.

The file id passed to the Delete file building block will be deleted. No further configuration required.

Useful combinations

You can either click on the keyboard icon to generate a form where you can enter the file id manually - or you can use the Find File building block to search for a file by name and retrieve the file id.

Complex reports

This example does show how to delete all obsolete files within a folder only skipping a template document.

It also shows a more detailed example of how to load worksheets containing data, extract specific information and separating them into individual reports. The example loads a revenue sheet where revenue data for all branches is maintained and separates this into individual reports for each branch of the current month.

Drive folder
del[].fileId
del[].file-name
del[].fileId
fileId
del[].file-name
fileName

Using the List Files building block all obsolete files in the reporting folder are selected. A Repeat building block combined with the Delete File building block deletes all files.

The skipping condition "${filename}" != "template" on the Delete File building block ensures a template file not to be deleted.

Branch list
brList[].branch

As a report for each branch should be created a list of all available branches is loaded. For each branch a report is created.

From the worksheet containing all revenue data the branch relevant entries are loaded using a branch= query in the Load worksheet building block .

The Calculate columns building block converts the dates given in the revenue sheet into the correct format. Here a From provides the relevant string/date conversion rules:

row.mydate = row.date.substring(6,10)+"-"+row.date.substring(3,5)+"-"+row.date.substring(0,2);

 

row.mymonth = parseInt(row.date.substring(3,5));

With the Filer rows building block all revenue entries of the current month are selected. The referring filter on the revenue table is row.mymonth == 12.

As the branch report is created newly every time the Ultradox file is executed (and the old files were deleted in the first step) the branch report template is selected with the Find file building block followed by a Copy files.

After the relevant rows were filtered the rows referring to the current branch are inserted into the branch specific report. In this example they just show date and revenue but of course more information can be added depending on the available data.

In a last step the Aggregate rows building block is used to calculate the current monthly revenue sum. In the form a variable for the monthly total is initialized result.total = 0; and the aggregation rule result.total += parseFloat(row.revenue); sums up the selected revenue items allowing them to be inserted as a summary row.

Revenue sheet
revenue[].branch
revenue[].date
revenue[].revenue
myDateExpression
myMonthExpression
revenue[].date
myDateExpression
revenue[].myDate
myMonthExpression
revenue[].myMonth
revenue[].date
Filtered Revenue
myMonthFilter
Report template
templateId
templateId
branchReport
branch
filteredRevenue[].date
date
filteredRevenue[].revenue
revenue
date
branchReport
revenue
aggregateRule
filteredRevenue[].revenue
branchSum
aggregateRule
branchSum
branchReport

Copy the Branch Report app to see this building block in action

Questions and Feedback

If you have any comments on this guide, feel free to add them right to the Google document that we are using to create this site.

If you are not yet member of the Ultradox community on Google+, please join now to get updates from our end or to provide feedback, bug reports or discuss with other users.

Last Updated:

Share on Google+Share on FacebookShare on TwitterShare on LinkedIn